package com.bosssoft.trainee.nontax.service.jwt;


import com.bosssoft.trainee.nontax.entity.dto.UserDto;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @Description: implement of token service
 * @Author: Luo WenLong
 * @Date: 2022/6/26 13:50
 */
public interface TokenService {
    /**
     * @Description: token获取工具
     * @param user 待制作token的user
     * @return: java.lang.String
     * @Author: Luo WenLong
     * @Date: 2022/6/26 14:02
     */
    String getToken(UserDto user);

    /**
     * @Description: 从token获取用户id
     * @param token jwt token
     * @return: java.lang.Integer
     * @Author: Luo WenLong
     * @Date: 2022/6/26 14:01
     */
    Integer getUserIdFromToken(String token);

    /**
     * @Description: 从request中获取用户id
     * @param httpServletRequest request
     * @return: java.lang.Integer
     * @Author: Luo WenLong
     * @Date: 2022/6/26 13:55
     */
    Integer getUserIdFromRequest(HttpServletRequest httpServletRequest);

    /**
     * @Description: 从token中获取角色权限信息
     * @param token token
     * @return: java.util.ArrayList<java.lang.String>
     * @Author: Luo WenLong
     * @Date: 2022/6/26 13:54
     */
    List<String> getUserRolesFormToken(String token);
}
